# Definition for an interval.
class Interval:
    def __init__(self, s=0, e=0):
        self.start = s
        self.end = e
import sys
class Solution:
    def eraseOverlapIntervals(self, intervals):
        """
        :type intervals: List[Interval]
        :rtype: int
        """
        a = sorted(intervals, key=lambda x: x.end)
        res = 0
        curend = -sys.maxsize
        for i in a:
            #             不满足接下来要删除
            if curend > i.start:
                res += 1
            else:
                curend = i.end
        return res

